#include"reg51.h"
sbit sound=P1^7;  	
#define f1(a) (65536-a)/256		
#define f2(a) (65536-a)%256    	
unsigned int i=500; 
unsigned int j=0; 
void main(void)
{
			EA=1;                  	
  		ET1=1;                	      
   		TMOD=0x10; 			  	
			TH1=f1(i);      		
   		TL1=f2(i);      			
   		TR1=1;                
   		while(1)  
{              				
				i=460; 
      	while(j<2000);
      	j=0;
      	i=360; 
      	while(j<2000);
      	j=0;
    }
}
 
void t1(void) interrupt 3 using 0	
{
    	TR1= 0;                 	
   	sound=~sound; 			
    	TH1=f1(i);   		
    	TL1=f2(i);   		
			j++;				
    	TR1=1;                 
}